//
//  AppDelegate.swift
//  EggTimer
//
//  Created by Huan Di on 12/01/2018.
//  Copyright © 2018 DHuan. All rights reserved.
//

import Cocoa

@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {

    @IBOutlet weak var startTimerMenuItem: NSMenuItem!
    @IBOutlet weak var stopTimerMenuItem: NSMenuItem!
    @IBOutlet weak var resetTimerMenuItem: NSMenuItem!
    
    func applicationDidFinishLaunching(_ aNotification: Notification) {
        // Insert code here to initialize your application
        let timerStatus = EggTimerActorStatus(enableStart:true, enableStop: false, enableReset:false)
        enableMenus(timerStatus: timerStatus)
    }

    func applicationWillTerminate(_ aNotification: Notification) {
        // Insert code here to tear down your application
    }
    
    func enableMenus(timerStatus: EggTimerActorStatus) -> Void {
        startTimerMenuItem.isEnabled = timerStatus.enableStart
        stopTimerMenuItem.isEnabled = timerStatus.enableStop
        resetTimerMenuItem.isEnabled = timerStatus.enableReset
    }
}

